﻿using System;
using System.Collections.Generic;
using System.Text;

using Torch.WL.DataAccess.CleanChina;
using Torch.WL.Entity.CleanChina;
using Torch.FrameWork.Utility;

namespace Torch.WL.Business.CleanChina
{
    class TbRewardManager
    {
        private readonly TbRewardAccess dal = new TbRewardAccess();

        private static TbRewardManager _rewardManager = new TbRewardManager ();
        public static TbRewardManager Instance()
        {

            return _rewardManager;
        }

        private TbRewardManager()
        {         
        }

        public List<TbRewardEntity> GetRewardListByCache()
        {

            string CacheKey = "TbRewardEntityListModel";
            object objModel = DataCache.GetCache(CacheKey);
            if (objModel == null)
            {
                try
                {
                    objModel = dal.GetRewardList();
                    if (objModel != null)
                    {
                        int ModelCache = ConfigHelper.GetConfigInt("ModelCache");
                        DataCache.SetCache(CacheKey, objModel, DateTime.Now.AddMinutes(ModelCache), TimeSpan.Zero);
                    }
                }
                catch { }
            }
            return (List<TbRewardEntity>)objModel;
        }




    }
}
